﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TrainingsApp.WebModel;
using TrainingsApp.Model;

namespace TrainingsApp.IPADApp.UserControls.Main.Student {
    public partial class UC_Index : AccountControl {

        protected void Page_Load(object sender, EventArgs e) {
            List<TS_Preview_Entity> previews = TrainingsApp.Logic.TS_Preview_Logic.TS_Preview_Result_TopByStudent(this.CurPage.CurrentUser.UserID);

            if (previews != null && previews.Count > 0) {
                var entity = previews.First();
                this.ltPreviewTip.Text = string.Format("你的老师于{0}发布了问题，你还没有表达自己的真实想法。", entity.PublishDate.ToString("yyyy-MM-dd"));
                this.rptPrevoewQuestion.DataSource = previews;
                this.rptPrevoewQuestion.DataBind();
            }
            else {
                this.ltPreviewTip.Text = "&nbsp;";
            }
        }
    }
}